import DrawV1 from "../../../engine/comps/DrawV1";
import User from "../../User";
import FillColorV2 from "../../../engine/comps/FillColorV2";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ColorRoomView extends cc.Component {


    @property(cc.Sprite)
    colorSprite: cc.Sprite = null;


    @property(cc.Prefab)
    roomViewPrefab: cc.Prefab = null;

    @property(DrawV1)
    draw: DrawV1 = null;

    @property(FillColorV2)
    panting: FillColorV2 = null;

    changeColor(color: cc.Color) {
        // cc.log(' color ', color)

        this.colorSprite.node.color = color;
    }



    onButtonOpenRoom() {
        // User.setImgData(this.draw.getData())
        // this.node.addChild(cc.instantiate(this.roomViewPrefab))
    }

    private scale: number = 1;

    onButtonScale() {
        this.scale += 0.1;
        if (this.scale > 3) {
            this.scale = 3;
        }
        this.panting.setScale(this.scale)
    }
    onButtonScaleSmalle() {
        this.scale -= 0.1;
        if (this.scale < 1) {
            this.scale = 1;
        }
        this.panting.setScale(this.scale)
    }
}
